<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>展示劳务合同记录</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<base href="<%=basePath%>">
		<script language="javascript" type="text/javascript"
			src="<%=basePath%>datemaker/WdatePicker.js">
</script>
		<script type="text/javascript" src="manage/js/jquery.js">
</script>
		<script type="text/javascript" src="manage/js/addbg.js">
</script>
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>manage/css/guanli.css"></link>
		<script type="text/javascript">
</script>

	</head>

	<body>
		<form action="showContractService" name="showContractService"
			method="POST">
			<h2 class="tableTitle">
				劳务合同信息
			</h2>
			<table class="cssrain">
				<thead>
					<tr>
						<th colspan="10">
							<input type="hidden" name="contractServiceTypeId"
								value="${contractServiceTypeId}" />
							<strong>员工编号：</strong>
							<input type="text" name="staffId" value="${staffId}"/>
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>按年月查找：<span>年份:</span>
							<select name="year" >
								<%
									Calendar calendar = Calendar.getInstance();
										int nowYear = calendar.get(Calendar.YEAR);
										for (int i = 2000; i <= nowYear; i++) {
								%>
								<option value="<%=i%>"
									<%Object yearObj = request.getAttribute("year");
					String year = null;
					if (yearObj != null)
						year = yearObj.toString();
					if (year != null && i == new Integer(year)) {%>
									selected="selected" <%}%>>
									<%=i%>
								</option>
								<%
									}
								%>
							</select>
				<span>月份:</span>
							<s:select name="month"
								list="#{1:'1月',2:'2月',3:'3月',4:'4月',5:'5月',6:'6月',7:'7月',8:'8月',9:'9月',10:'10月',11:'11月',12:'12月'}"></s:select>
							<input type="submit" value="提交" />
							&nbsp;&nbsp;&nbsp;
						</th>
					</tr>
					<tr>
						<th>
							员工编号
						</th>
						<th>
							劳务类型
						</th>
						<th>
							劳务合同创建日期
						</th>
						<th>
							劳务合同开始日期
						</th>
						<th>
							劳务合同结束日期
						</th>
						<th>
							文件链接
						</th>
					</tr>
				</thead>
				<tbody>
					<s:if test="contractServiceList!=null && !contractServiceList.isEmpty()">
						<s:iterator value="contractServiceList">
							<tr>
								<td>
									<s:property value="staff.staffId" />
								</td>
								<td>
									<s:property value="type.name" />
								</td>
								<td>
									<s:property value="date" />
								</td>
								<td>
									<s:property value="start" />
								</td>
								<td>
									<s:property value="end" />
								</td>
								<td>
									<a href="<%=basePath%><s:property value="url"/>"
										target="_blank">URL</a>
								</td>
							</tr>
						</s:iterator>
					</s:if>
					<s:else>
						<tr>
							<td colspan="6">没有记录</td>
						</tr>
					</s:else>
					</tbody>
					<tfoot>
					<tr>
						<td colspan="10">
							<s:if test="pageModel.currentPage != 1">
								<input type="button" value="首页" class="firstPage"
									onclick="location.href='showContractService?contractServiceTypeId=${contractServiceTypeId}&pageModel.currentPage=1'" />
								<input class="frontPage" type="button" value="上一页"
									onclick="location.href='showContractService?contractServiceTypeId=${contractServiceTypeId}&pageModel.currentPage=${pageModel.currentPage - 1}'" />
							</s:if>
							<s:else>
								<input class="firstPage" type="button" value="首页" disabled />
								<input class="frontPage" type="button" value="上一页" disabled />
							</s:else>
							<s:if test="pageModel.currentPage != pageModel.totalPages">
								<input class="secondPage" type="button" value="下一页"
									onclick="location.href='showContractService?contractServiceTypeId=${contractServiceTypeId}&pageModel.currentPage=${pageModel.currentPage + 1}'" />
								<input class="lastPage" type="button" value="尾页"
									onclick="location.href='showContractService?contractServiceTypeId=${contractServiceTypeId}&pageModel.currentPage=${pageModel.totalPages}'" />
							</s:if>
							<s:else>
								<input class="secondPage" type="button" value="下一页" disabled />
								<input class="lastPage" type="button" value="尾页" disabled />
							</s:else>
							${pageModel.currentPage}/${pageModel.totalPages}
						</td>
					</tr>
				</tfoot>
			</table>
		</form>
	</body>
</html>
